package org.me.marble;

import javax.microedition.khronos.opengles.GL10;

/**
*
* @author tungi
*/

public class Light{
    public MyColor _color;
    public Vector _position;

    public Light(){
    }

    public Vector getPosition(){
        return _position;
    }

    public void specLight(GL10 gl){
        //enable and specifiy light0
        gl.glEnable(GL10.GL_LIGHTING);
        gl.glEnable(GL10.GL_LIGHT0);
        gl.glLightfv(GL10.GL_LIGHT0,GL10.GL_POSITION,_position.toArray(),0);
        gl.glLightfv(GL10.GL_LIGHT0,GL10.GL_AMBIENT,_color.getAmbient(),0);
        gl.glLightfv(GL10.GL_LIGHT0,GL10.GL_DIFFUSE,_color.getDiffuse(),0);
        gl.glLightfv(GL10.GL_LIGHT0,GL10.GL_SPECULAR,_color.getSpecular(),0);        
    }
    
    public void enableLight(GL10 gl){
        //enable lighting and set the light position
        gl.glEnable(GL10.GL_LIGHTING);
        gl.glEnable(GL10.GL_LIGHT0);
    }

    public void disableLight(GL10 gl){
        gl.glDisable(GL10.GL_LIGHTING);
    }
}
